<%--
@Created by IntelliJ IDEA
@Project_Name ieco_server
@Package 
@Author ZhongYao_H
@Date 2019/5/14:10:02
@Year 2019 Month 05 Day 14
@Date_zh  2019年 五月 星期二
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico"> <link href="${pageContext.request.contextPath}/assets/hplus/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <%@include file="/WEB-INF/common/hplus-css.jsp"%>
    <%@include file="/WEB-INF/common/hplus-js.jsp" %>
    <style>

        html,body{
            height: 100%;
            width: 100%;
        }

    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content">

    <form  class="form-horizontal m-t" action="${pageContext.request.contextPath}/city/add" id="form" method="post">
        <div class="form-group">
            <label class="col-sm-3 control-label">城市名称：</label>
            <div class="col-sm-7">
                <input type="text"  name="name" id="name" class="form-control"
                       placeholder="上海,北京,广州........" required aria-required="true">
            </div>

        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">纬度：</label>
            <div class="col-sm-3">
                <input type="text" onclick="getCoord()" name="lat"  id="lat" class="form-control" maxlength="35"
                       placeholder="点击选择">
            </div>
            <label class="col-sm-1 control-label">经度：</label>
            <div class="col-sm-3">
                <input type="text" onclick="getCoord()"  name="lon" id="lon" required aria-required="true" class="form-control"
                       placeholder="点击选择">
            </div>
        </div>

    </form>
    <div class="form-group">&nbsp;
        <div class="col-sm-4 col-sm-offset-3" style="text-align: center;">
        </div>
    </div>
    <div class="form-group">&nbsp;
        <div class="col-sm-4 col-sm-offset-3" style="text-align: center;">
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-4 col-sm-offset-3" style="text-align: center;">
            <button class="btn btn-primary" id="add-btn" onclick="submit()" type="button">提交</button>
        </div>
    </div>

</div>




 <div id="hiden" style="display: none">
 <form id="fileform" action="${pageContext.request.contextPath}/file/uploadimage" enctype="multipart/form-data">
     <input name="file" id="file" accept="image/jpeg,image/jpg,image/png,image/gif" onchange="imgUpload(this)" type="file">
 </form>

 </div>

<!-- 全局js -->
<%--<script src="${pageContext.request.contextPath}/assets/hplus/js/jquery.min.js?v=2.1.4"></script>--%>
<script src="${pageContext.request.contextPath}/assets/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/hplus/js/bootstrap.min.js?v=3.3.6"></script>
<!-- 自定义js -->
<script src="${pageContext.request.contextPath}/assets/hplus/js/content.js?v=1.0.0"></script>
<!-- SUMMERNOTE -->
<script type="text/javascript">

    $(document).ready(function () {

    });


     function submit() {

         if ($("#lat").val()=='' || $("#name").val()=='' ){
             layer.msg('填写信息不完整',{icon:5})
             return
         }
             $("#form").ajaxSubmit({
                 dataType:'json',
                 type:"POST",
                 success:function (json) {
                     var code = json.code;
                     if (code==0){
                         layer.msg(json.msg,{icon:1})
                         setTimeout(function () {
                             parent.window.location.reload();
                         },1000)

                     }else {
                         layer.msg(json.msg,{icon:5})
                     }
                 }
             });

    }

    var index ;
    function getCoord(){
        index = layer.open({
            type: 2,
            title: '取点',
            shadeClose: true,
            shade: 0.5,
            area: ['80%', '80%'],
            content: '${path}/place/map' //iframe的url
        });
    }

    function getcoordinates(lng,lat){
        $("#lon").val(lng);
        $("#lat").val(lat);

    }

    function close() {
        layer.close(index);
    }


</script>
</body>
</html>
